home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / ai.prl / mike1.exe / MIKE.PL < prev    next >
Encoding:
Text File  |  1990-09-16  |  6.4 KB  |  143 lines

  1. /* file: MIKE.PL {master file, loads the others} */
  2. mike_version('1.40, 16th September, 1990.').
  3. /*
  4.                             *************
  5.                                M I K E
  6.                             *************
  7.                Micro Interpreter for Knowledge Engineering
  8.                   {written in Edinburgh-syntax Prolog}
  9.  
  10. MIKE: Copyright (c) 1989, 1990 The Open University (U.K.)
  11.  
  12. MIKE is intended for educational purposes, and may not
  13. be sold as or incorporated in a commercial product without
  14. written permission from: The Copyrights Officer, Open University,
  15. Milton Keynes MK7 6AA, U.K.
  16.  
  17. The Open University accepts no responsibility for any legal or other
  18. consequences which may arise directly or indirectly as a result of the
  19. use of all or parts of the contents of this program.
  20.  
  21. This software accompanies Open University Study Pack PD624, 'KNOWLEDGE
  22. ENGINEERING'.  Complete sets of study pack materials may be obtained from:
  23.  
  24.                       Learning Materials Sales Office
  25.                       The Open University
  26.                       P.O. Box 188
  27.                       Milton Keynes MK7 6DH, U.K.
  28.  
  29.                       Tel: [+44] (908) 653338
  30.                       Fax: [+44] (908) 653744
  31. */
  32.  
  33. /*
  34. IT IS CRITICAL THAT THIS FILE (MIKE.PL) BE LOADED USING consult RATHER
  35. THAN reconsult, I.E.   ?- consult('mike.pl').
  36. ALL OTHER FILES SHOULD BE LOADED USING reconsult, AS DESCRIBED IN THE
  37. PD624 (KNOWLEDGE ENGINEERING) COURSE TEXT. KNOWLEDGE BASES CAN OPTIONALLY BE
  38. LOADED WITH THE MORE INFORMATIVE UTILITY kb, as in ?- kb 'flu.kb'.
  39. THIS IS DESCRIBED IN THE FILE READ.ME.
  40. */
  41.  
  42. 'Show Version' :- mike_version(Version), write('MIKE V'),write(Version).
  43.  
  44. commands :-
  45.  writel([
  46.  'COMMAND   EXAMPLE                    EXPLANATION'
  47. ,'add       add ''hi there''.            Adds string ''hi there'' to working mem.'
  48. ,'          add [jo,says,hi].          Adds the list [jo,says,hi] to working mem.'
  49. ,'browse    browse.                    Shows current frame hierarchy.'
  50. ,'          browse(person).            Shows frame hierarchy beneath person.'
  51. ,'deduce    deduce [Who,says,What].    Triggers backward chaining rules.'
  52. ,'describe  describe tom.              Displays details of frame called tom.'
  53. ,'          describe rule3.            Displays details of rule called rule3.'
  54. ,'fc        fc.                        Forward Chain (clears wm & runs rules).'
  55. ,'go        go.                        Like fc, but leaves current wm intact.'
  56. ,'kb        kb ''flu.kb''.               Loads new knowledge base (KILLS OLD!).'
  57. ,'note      note the age of tom is 34. Stores new slot-filler info in frame.'
  58. ,'remove    remove ''hi there''.         Removes string ''hi there'' from wm.'
  59. ,'show      show frames.               Displays currently loaded frames.'
  60. ,'          show history.              Displays history of rule execution.'
  61. ,'          show rules.                Displays names of loaded rules.'
  62. ,'          show wm.                   Displays contents of working memory.'
  63. ,'strategy  strategy menu.             Menu of 3 conflict resol''n strategies.'
  64. ,'          strategy [refractoriness]. Restricts conflict resolution strategy.'
  65. ,'tracing   tracing.                   Menu of numerous tracing options.'
  66. ,'          tracing(4).                Toggles option 4 between on and off.'
  67. ]).
  68.  
  69. /* COMPATIBILITY NOTE: next line not allowed in some dialects!!! */
  70. help :- commands.
  71.  
  72. /* 2 options for loading MIKE: (a) modules (pre-tokenized & fast),
  73.                                (b) sources
  74.    The corresponding predicates which do the work are
  75.                                (a) loadmikemodules
  76.                                (b) loadmikesources
  77.    Dialect-specific tests and loading facilities are commented below
  78. */
  79.  
  80. loadmikemodules :- /* See further 'COMPATIBILITY NOTE' at end of this file */
  81.   lmm(readwrite), /* ESL Prolog-2-specific... assumes MIKE.PL is consulted */
  82.   reconsult('loadops.pl'), /* operators are outside the scope of modules */
  83.   reconsult('mike.ini'). /* You can alter MIKE.INI to load your own stuff */
  84.  
  85. /*
  86. You may need to alter the lines which follow to refer to the appropriate
  87. pathname, e.g.
  88.     ?- reconsult('c:\mike\loadops.pl')
  89. */
  90.  
  91. loadmikesources :-
  92.    write('Loading auxiliary MIKE files'),
  93.    reconsult('loadops.pl'), write('.'),
  94.    reconsult('engine1.pl'), write('.'),
  95.    reconsult('engine2.pl'), write('.'),
  96.    reconsult('fc_exec.pl'), write('.'),
  97.    reconsult('io.pl'), write('.'),
  98.    reconsult('util.pl'), write('.'),
  99.    reconsult('findall.pl'), write('.'),
  100.    reconsult('browse.pl'), write('.'),
  101.    reconsult('mike.ini'), write('.'). /* Use MIKE.INI for your own stuff */
  102.  
  103. mikegreeting :-
  104.    writel([nl,nl,nl,nl,nl,nl,nl,
  105. '               MM          MM  II  KK        KK  EEEEEEEEEEE',
  106. '               MMMM      MMMM  II  KK      KK    EE',
  107. '               MM  MM  MM  MM  II  KK    KK      EE',
  108. '               MM    MM    MM  II  KK  KK        EE',
  109. '               MM          MM  II  KKKK          EEEEEE',
  110. '               MM          MM  II  KK  KK        EE',
  111. '               MM          MM  II  KK    KK      EE',
  112. '               MM          MM  II  KK      KK    EE',
  113. '               MM          MM  II  KK        KK  EEEEEEEEEEE',
  114. ' ',
  115. '                Micro Interpreter for Knowledge Engineering',
  116. '     from Open University Text/Video Study Pack PD624: KNOWLEDGE ENGINEERING',
  117. ' ',
  118. 'Copyright (C) 1990 The Open University, Milton Keynes, UK. Tel.+44 908 653338'
  119. ]),nl,
  120. writel(['See MIKE.DOC for liability disclaimer, copyright notice, setup info.']),
  121.     nl,
  122.     'Show Version',
  123.     nl,
  124.     writel(['For quick summary, type','  ?- commands.']).
  125.  
  126. /* ---------------- COMPATIBILITY NOTE: ---------------------------------
  127.    There are two options for loading MIKE: (a) modules; (b) sources.
  128.    The test for the existence of (pre-tokenized, fast-loading) modules
  129.    and the module-loading facility itself are both dialect-specific.
  130.  
  131.    The line of code which follows means:
  132.      IF the file 'mike_mod.prm' exists in your current default directory,
  133.      THEN load it using the ESL Prolog-2 module-loading facility,
  134.      ELSE load the source code (invokes standard 'reconsult').
  135. */
  136.  
  137. ?- (exists_file('mike_mod.prm'), loadmikemodules) ; loadmikesources.
  138.  
  139. /* If you want to load the source code using your own dialect of
  140.    Prolog, simply get rid of the above test and just invoke
  141.    ?- loadsources.
  142. */
  143. ?- mikegreeting.  /* Output the greeting info defined above */